<div class="nav-sub w1180">
	<ul class="zoom">
		<li><a class="on" href="/crm/index/index">城市管理</a></li>
		<li><a href="/crm/index/catalog">商户类型管理</a></li>
	</ul>
</div>
<div class="main-ct w1180">
	<div class="top-bar">
		<div class="custom-search">
			<a href="javascript:search();" class="btn-cs btn-search ml5">查 询</a>
		</div>
		<a class="btn-cs btn-fillet btn-green" href="/crm/index/add-city">新增城市</a>
	</div>
<div id="list-table"></div>
</div>

<script type="text/javascript">
    var page = 1;
    
    $(document).ready(function(){
    	ajaxListTable();
    });
    function search(){
    	page = 1;
    	ajaxListTable();
    }
    function ajaxListTable(){
    	$.ajax({
            type: "post",
            url: "<?php echo $this->url('crm/index',
                array('action'=>'ajax-city-list'));?>",
            dataType:'html',
            data: { 
    				"page":page
    		},
            cache: false,
            timeout:10000, 
            error: function(){
              	 alert('请求超时，请重新操作');
               	 isPost = false;
                 return false; 
             }, 
            success: function(html){
            	$("#list-table").html(html);
            }
        });
    }

    function deleteCity(city_id){

        if(confirm("确定要删除吗？"))
        {
            $.ajax({
                type: "post",
                url: "<?php echo $this->url('crm/index',
                array('action'=>'delete-city'));?>",
                dataType:'json',
                data: { 
        				"city_id":city_id
        		},
                cache: false,
                timeout:10000, 
                error: function(){
                  	 alert('请求超时，请重新操作');
                     return false; 
                 }, 
                success: function(result){
                    if(result.result != 'true'){
                        alert(result.reason);
                    }
                    ajaxListTable();
                }
            });
        }
    }
</script>